<template>
  <div class="home">
    <!-- 轮播图区域 -->
    <el-carousel height="400px" class="hero-carousel">
      <el-carousel-item v-for="item in carouselItems" :key="item.id">
        <div class="carousel-item" :style="{ backgroundImage: `url(${item.image})` }">
          <div class="carousel-content">
            <h2>{{ item.title }}</h2>
            <p>{{ item.description }}</p>
            <!-- <el-button type="primary" size="large">{{ item.buttonText }}</el-button> -->
          </div>
        </div>
      </el-carousel-item>
    </el-carousel>

    <!-- 功能介绍区域 -->
    <div class="features-section">
      <div class="container">
        <h2 class="section-title">我们的服务</h2>
        <div class="features-grid">
          <div class="feature-card" v-for="feature in features" :key="feature.id">
            <div class="feature-icon">
              <i :class="feature.icon"></i>
            </div>
            <h3>{{ feature.title }}</h3>
            <p>{{ feature.description }}</p>
            <el-button type="text" @click="$router.push(feature.link)">了解更多 →</el-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Home',
  
  data() {
    return {
      carouselItems: [
        {
          id: 1,
          title: '给它们一个温暖的家',
          description: '每一只宠物都值得被爱，让我们一起为它们找到最好的归宿',
          buttonText: '开始领养',
          image: 'https://images.unsplash.com/photo-1601758228041-f3b2795255f1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80'
        },
        {
          id: 2,
          title: '救助需要帮助的小生命',
          description: '及时的救助可以挽救一个生命，让我们携手帮助更多的宠物',
          buttonText: '参与救助',
          image: 'https://images.unsplash.com/photo-1548199973-03cce0bbc87b?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80'
        },
        {
          id: 3,
          title: '分享养宠经验',
          description: '在这里与其他宠物爱好者交流心得，分享快乐时光',
          buttonText: '加入论坛',
          image: 'https://images.unsplash.com/photo-1583337130417-3346a1be7dee?ixlib=rb-4.0.3&auto=format&fit=crop&w=1200&q=80'
        }
      ],
      
      features: [
        {
          id: 1,
          title: '宠物领养',
          description: '浏览可爱的宠物，为它们找到温暖的家庭',
          icon: 'el-icon-star-on',
          link: '/adoption-browse'
        },
        {
          id: 2,
          title: '宠物救助',
          description: '发现需要帮助的宠物，及时提供救助信息',
          icon: 'el-icon-first-aid-kit',
          link: '/rescue'
        },
        {
          id: 3,
          title: '交流论坛',
          description: '与其他宠物爱好者分享经验和快乐时光',
          icon: 'el-icon-chat-dot-round',
          link: '/forum'
        }
      ]
    }
  }
}
</script>

<style scoped>
/* 轮播图样式 */

.carousel-item {
  height: 400px;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.carousel-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
}

.carousel-content {
  text-align: center;
  color: white;
  z-index: 1;
  position: relative;
}

.carousel-content h2 {
  font-size: 36px;
  margin-bottom: 16px;
  font-weight: bold;
}

.carousel-content p {
  font-size: 18px;
  margin-bottom: 24px;
  max-width: 600px;
}

/* 功能介绍区域 */
.features-section {
  padding: 40px 0;
  background: #f8f9fa;
}

.section-title {
  text-align: center;
  font-size: 32px;
  color: #333;
  margin-bottom: 50px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.feature-card {
  background: white;
  padding: 40px 30px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 48px;
  color: #409EFF;
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 24px;
  color: #333;
  margin-bottom: 15px;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}
</style>